package cn.fly.blog.home.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.fly.blog.home.mapper.AccountMapper;
import cn.fly.blog.base.db.entity.Account;
import cn.fly.blog.home.service.AccountService;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * (Account)表服务实现类
 *
 * @author flython by EasyCode
 * @since 2021-08-10 00:28:32
 */
@Service("accountService")
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements AccountService {

    @Override
    public String pickHistoryById(Long id) {
        LambdaQueryWrapper<Account> lqw = new LambdaQueryWrapper<>();
        lqw.select(Account::getHistory);
        return Optional.ofNullable(getBaseMapper().selectOne(lqw)).map(Account::getHistory).orElse("[null]");
    }
}
